package com.jiuyuan.entity.vo;

import com.jiuyuan.entity.Menu;
import com.sun.istack.internal.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @program: hrms
 * @description:
 * @author: Feng
 * @create: 2023-02-15 08:48
 **/

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RespBean {
    private Long code;
    private String message;
    private Object obj;

    public static RespBean success(String mess){
        return new RespBean(200L,mess,null);
    }
    public static RespBean success(String mess,Object obj){
        return new RespBean(200L,mess,obj);
    }
    public static RespBean error(String mess){
        return new RespBean(500L,mess,null);
    }
    public static RespBean error(String mess,Object obj){
        return new RespBean(500L,mess,obj);
    }

    public static RespBean success(RespBeanEnum respBeanEnum){
        return new RespBean(Long.valueOf(respBeanEnum.getCode()),respBeanEnum.getMessage(),null);
    }
    public static RespBean error(RespBeanEnum respBeanEnum){
        return new RespBean(Long.valueOf(respBeanEnum.getCode()),respBeanEnum.getMessage(),null);
    }

    public static RespBean success(Object obj) {
        return new RespBean(200L,"请求成功",obj);
    }
}
